﻿package com.mypaper.elem;


public class ScheduleElement extends DataElement{
	public int taskID;
	public int processorID;
	public float startTime;
	public float endTime;
	
	public ScheduleElement(){
		taskID=0;
		processorID=0; 
		startTime=0;
		endTime=0;
	}
	
	public ScheduleElement(int taskID, int processorID, float startTime, float endTime){
		this.taskID=taskID;
		this.processorID=processorID;
		this.startTime=startTime;
		this.endTime=endTime;
	}
	
	public void setNum(int taskID, int processorID, float startTime, float endTime){
		this.taskID=taskID;
		this.processorID=processorID;
		this.startTime=startTime;
		this.endTime=endTime;
	}

	public int compareTo(DataElement otherElement) {
		ScheduleElement other=(ScheduleElement)otherElement;
		if(processorID>other.processorID)// TODO Auto-generated method stub
			return -1;
		else
			return 1;
	}

	@Override
	public boolean equals(DataElement otherElement) {
		ScheduleElement newNode=(ScheduleElement)otherElement;
		if(this.taskID==newNode.taskID && this.processorID==newNode.processorID && this.startTime==newNode.startTime && this.endTime==newNode.endTime)
			return true;
		else
			return false;
	}
	
	public boolean equals(int taskID, int processorID) {
		if(this.taskID==taskID&&this.processorID==processorID)
			return true;
		else
			return false;
	}

	@Override
	public ScheduleElement getCopy() {
		ScheduleElement temp=new ScheduleElement(taskID, processorID, startTime, endTime);
		return temp;
	}

	@Override
	public void makeCopy(DataElement otherElement) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public DataElement properSlot(DataElement searchItem) {
		// TODO Auto-generated method stub
		return null;
	}
	
	public String toString(){
		return String.valueOf("["+taskID+","+processorID+","+startTime+","+endTime+"]");
	}

	@Override
	public boolean equalStart(float end) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean equalEnd(float start) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public DataElement properSlotMoveTo(float start, float end, float weight) {
		// TODO Auto-generated method stub
		return null;
	}
}
